<docs>
  ## 编辑个人基本信息
</docs>
<template>
  <div class="wrap">
    <div class="tab-wrap">
      <div class="active">
        <router-link :to="{ path: '/person/baseInfo/pBaseInfo'}">人员信息</router-link>
      </div>
      <div @click="qfyx_link">
        <!-- <router-link :to="{ path: '/person/baseInfo/jobIntent'}"> -->
        求职意向
        <!-- </router-link> -->
      </div>
      <div @click="gzjl_link">
        <!-- <router-link :to="{ path: '/person/baseInfo/workHistory'}"> -->
        工作经历
        <!-- </router-link> -->
      </div>
      <div @click="xxjl_link">
        <!-- <router-link :to="{ path: '/person/baseInfo/schoolExper'}"> -->
        学习经历
        <!-- </router-link> -->
      </div>
      <div @click="qtxx_link">
        <!-- <router-link :to="{ path: '/person/baseInfo/otherInfo'}"> -->
        其他信息
        <!-- </router-link> -->
      </div>
    </div>
    <!-- 基本信息 -->
    <div class="common">
      <div class="touxiang tem_comm" style="position: relative">
        <div class="edit_btn_right" @click="editPic">
          <i class="iconfont icon-edit"></i> 上传
        </div>
        <div>
          <img class="images" :src="imgSrc" alt />
        </div>
      </div>
      <div class="point tem_comm baseinfo">
        <div class="edit_btn_comm" @click="editBaseInfo">
          <i class="iconfont icon-edit">编辑</i>
        </div>
        <p class="person">{{jbxx.xm}}</p>
        <p class="item">
          <span class="list_l duiqi">身份证</span>
          <span class="list_r">{{jbxx.sfzhm.substring(0, 14)}}****</span>
        </p>
        <p class="item"></p>
        <p class="item">
          <span class="list_l">性别</span>
          <span class="list_r">{{jbxx.xb_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">年龄</span>
          <span class="list_r">{{jbxx.nl}}</span>
        </p>
        <p class="item">
          <span class="list_l">民族</span>
          <span class="list_r">{{jbxx.mz_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">政治面貌</span>
          <span class="list_r">{{jbxx.zzmm_xs}}</span>
        </p>
        <!-- <p class="item">
          <span class="list_l">婚姻状况</span><span class="list_r">{{jbxx.hyzk_xs}}</span>
        </p>-->
        <p class="item">
          <span class="list_l">人员类别</span>
          <span class="list_r">{{jbxx.rylb_xs}}</span>
        </p>

        <p class="item">
          <span class="list_l">户籍性质</span>
          <span class="list_r">{{jbxx.hjxz_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">户籍地行政区划</span>
          <span class="list_r">{{jbxx.hjdxzqh_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">居住地行政区划</span>
          <span class="list_r">{{jbxx.jzdxzqh_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">文化程度</span>
          <span class="list_r">{{jbxx.whcd_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">身高</span>
          <span class="list_r">{{jbxx.sg}}</span>
        </p>
        <p class="item">
          <span class="list_l">体重</span>
          <span class="list_r">{{jbxx.tz}}</span>
        </p>
        <p class="item">
          <span class="list_l">视力（左）</span>
          <span class="list_r">{{jbxx.zysl_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">视力（右）</span>
          <span class="list_r">{{jbxx.yysl_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">健康状况</span>
          <span class="list_r">{{jbxx.jkzk_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">所学专业</span>
          <span class="list_r">{{jbxx.sxzy}}</span>
        </p>
        <p class="item">
          <span class="list_l">毕业院校</span>
          <span class="list_r">{{jbxx.byyx}}</span>
        </p>
        <p class="item">
          <span class="list_l">毕业时间</span>
          <span class="list_r">{{jbxx.bysj}}</span>
        </p>
        <p class="item">
          <span class="list_l">毕业院校类别</span>
          <span class="list_r">{{jbxx.byyxlb_xs}}</span>
        </p>
        <p class="item">
          <span class="list_l">第二学历</span>
          <span class="list_r">{{jbxx.dexl}}</span>
        </p>
        <p class="item">
          <span class="list_l">联系人</span>
          <span class="list_r">{{jbxx.lxr}}</span>
        </p>
        <p class="item">
          <span class="list_l">联系人电话</span>
          <span class="list_r">{{jbxx.lxrdh}}</span>
        </p>
        <p class="item">
          <span class="list_l">其他说明</span>
          <span class="list_r">{{jbxx.qtsm}}</span>
        </p>
        <p class="item">
          <span class="list_l">固定电话</span>
          <span class="list_r">{{jbxx.gddh}}</span>
        </p>
        <p class="item">
          <span class="list_l">手机号码</span>
          <span class="list_r">{{jbxx.sj}}</span>
        </p>
        <p class="item">
          <span class="list_l">电子邮箱</span>
          <span class="list_r">{{jbxx.email}}</span>
        </p>
      </div>
    </div>
  </div>
</template>
<script>
import $ from "@/common/js/axios";
import editBaseInfo from "./editBaseInfo";

export default {
  name: "pBaseInfo",
  components: { editBaseInfo },
  data() {
    return {
      jbxx: {
        grqzid: "",
        sfzhm: "",
        xb: "",
        mz: "", // 民族
        nl: "", // 年龄
        sj: "", // 手机号
        gddh: "", // 固定电话
        email: "",
        hjxz: "", // 户籍性质
        rylb: "", // 人员类别
        zysl: "", // 视力（左）
        yysl: "", // 视力（右）
        hjdxzqh: "", // 户籍地行政区划
        whcd: "", // 文化程度
        jzdxzqh: "", // 居住地行政区划
        jzddz: "", // 居住地地址
        jkzk: "", // 健康状况
        hkszd: "", // 户口所在地
        zzmm: "", // 政治面貌
        // hyzk: '',  // 婚姻状况"
        sg: "", // 身高"
        tz: "", // 体重"
        sxzy: "", // 所学专业
        byyx: "", // 毕业院校
        bysj: "", // 毕业时间
        byyxlb: "", // 毕业院校类别
        dexl: "", // 第二学历
        lxr: "", // 联系人
        lxrdh: "", // 联系人电话"
        qtsm: "" // 其他说明"
      },
      jbxxflag: "", // 基本信息 0无信息  不能操作其他跳转
      qzxxflag: "", // 求职信息 0无信息  不能操作除基本信息，求职外的其他信息
      changFlag: 1
    };
  },
  computed: {
    imgSrc() {
      /* eslint-disable no-undef */
      return `${conf.urlPrefix}/grgl/tpxxCx?changflag=` + this.changFlag + 1;
    }
  },
  methods: {
    /*  求职意向  */
    qfyx_link() {
      if (this.qzxxflag == 0) {
        if (this.jbxxflag == 0) {
          this.$alert("请填写人员信息");
        } else if (this.jbxxflag == 1) {
          this.$router.push({ path: "/person/baseInfo/jobIntent" });
        }
      } else if(this.qzxxflag == 1) {
         this.$router.push({ path: "/person/baseInfo/jobIntent" });
      }

    },
    /*  工作经历 */
    gzjl_link() {
      if (this.qzxxflag == 0) {
        if (this.jbxxflag == 0) {
          this.$alert("请填写人员信息");
        } else if (this.jbxxflag == 1) {
         this.$alert("请填写求职意向");
        }
      } else if(this.qzxxflag == 1) {
         this.$router.push({ path: "/person/baseInfo/workHistory" });
      }
    },
    /*  学习经历 */
    xxjl_link() {
      if (this.qzxxflag == 0) {
        if (this.jbxxflag == 0) {
          this.$alert("请填写人员信息");
        } else if (this.jbxxflag == 1) {
         this.$alert("请填写求职意向");
        }
      } else if(this.qzxxflag == 1){
         this.$router.push({ path: "/person/baseInfo/schoolExper" });
      }
    },
    /*  其他信息 */
    qtxx_link() {
      if (this.qzxxflag == 0) {
        if (this.jbxxflag == 0) {
          this.$alert("请填写人员信息");
        } else if (this.jbxxflag == 1) {
         this.$alert("请填写求职意向");
        }
      } else if(this.qzxxflag == 1){
         this.$router.push({ path: "/person/baseInfo/otherInfo" });
      }
    },

    /*  查询基本信息 */
    GET_getInfo() {
      this.$loading = true;
      this.$http
        .get("/grgl/grxqCx")
        .then(res => {
          const resData = res.returnData;
          this.jbxx = resData.jbxx;
        })
        .finally(() => {
          this.$loading = false;
        });
    },
    // 编辑个人基本信息
    editBaseInfo() {
      this.$router.push({
        path: "/person/baseInfo/edit",
        params: { data: this.jbxx }
      });
    },
    // 编辑图片
    editPic() {
      this.jbxx.changFlag = this.changFlag;
      this.$router.push({
        path: "/person/baseInfo/uploadPic",
        query: this.jbxx
      });
    },
    async GET_personInfo() {
      const res = await this.$http.get("/grgl/sfyqzdj");
      const userInfo = res.returnData.grjbxx;
      this.$store.commit("SET_USER_INFO", {
        name: userInfo.xm,
        sfzhm: userInfo.sfzhm,
        grbh: userInfo.grbh,
        sfyjbdj: userInfo.sfyjbdj,
        sfyqzdj: userInfo.sfyqzdj
      });
      // 基本信息
      this.jbxxflag = this.$store.state.userInfo.sfyjbdj;

      // 求职信息
      this.qzxxflag = this.$store.state.userInfo.sfyqzdj;
    }
  },
  created() {
    this.GET_personInfo();
    if (this.$route.query.changFlag) {
      this.changFlag = this.$route.query.changFlag + 1;
    }
    this.GET_getInfo();
  }
};
</script>
<style scoped lang="scss">
@import "~common/scss/var.scss";
.wrap {
  background: $color-bg;
  .btn-wrap {
    display: flex;
    .weui-btn {
      margin: $margin-base auto;
      flex: 0 1 47%;
    }
  }
}

.edit_btn_right {
  position: absolute;
  top: 20px;
  right: -50px;
  color: #2e7ef7;
}
</style>
